跳到主要内容

GetCommentById

Returns a comment from the current document by its ID.

Syntax

expression.GetCommentById(sId);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sIdRequiredstringThe comment ID.

Returns

ApiComment

Example

This example shows how to get a comment from the current document by its ID.

var oComment = Api.AddComment("Comment", "Bob");
var sId = oComment.GetId();
oComment = Api.GetCommentById(sId);
var oWorksheet = Api.GetActiveSheet();
oWorksheet.GetRange("A1").SetValue("Commet Text: ", oComment.GetText());
oWorksheet.GetRange("B1").SetValue("Commet Author: ", oComment.GetAuthorName());